<!--
 * @Author: 黄荣基
 * @Date: 2020-12-01 15:02:54
 * @LastEditors: 黄荣基
 * @LastEditTime: 2020-12-01 15:44:29
-->
<template>
  <div class="home">
    {{ city }} {{ text }} {{ temp }}℃
    <el-button type="primary">主要按钮</el-button>
  </div>
</template>

<script>
export default {
  name: 'Home',
  data() {
    return {
      city: '广州',
      text: null,
      temp: null
    };
  },
  mounted() {
    this.$http.demo.list().then(res => {
      console.log(res);
    });

    this.$http.demo
      .weatherInfo({
        locationName: this.city,
        type: 'now'
      })
      .then(res => {
        console.log(res);
        if (res && res.data) {
          const {
            data: { now }
          } = res;
          this.text = now.text;
          this.temp = now.temp;
        }
      });
  }
};
</script>
